package com.pl.buisness.profile.service.controller.fallback;

import com.pl.buisness.profile.service.controller.ProfileController;
import com.pl.myshop.commons.dto.ResponseResult;
import com.pl.myshop.commons.dto.errorcode.ErrorCodeEnmu;
import com.pl.myshop.provider.domain.UmsAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * <p>
 *
 * @Description: TODO
 * </p>
 * @ClassName ProfileController
 * @Author pl
 * @Date 2020/4/2
 * @Version V1.0.0
 */
public class ProfileControllerFallback {
    private static final Logger logger = LoggerFactory.getLogger(ProfileController.class);

    public static ResponseResult<UmsAdmin> getUserProfileFallback(String userName, Throwable ex){
        logger.warn("Invoke getByUsernameFallback: " + ex.getClass().getTypeName());
        ex.printStackTrace();
        UmsAdmin umsAdmin = new UmsAdmin();
        umsAdmin.setUsername("熔断");
        return new ResponseResult<UmsAdmin>(ErrorCodeEnmu.DBUBBO_SENTINEL.getErrorCode(),ErrorCodeEnmu.DBUBBO_SENTINEL.getMessage(),umsAdmin);
    }

}